Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add few shell filters #84179

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fabiobaltieri
Copy link
Member

Add few shell filter functions, i2c, regulator and dac.

pdgendt
pdgendt previously approved these changes Jan 17, 2025
kartben
kartben previously approved these changes Jan 17, 2025
keith-zephyr
keith-zephyr previously approved these changes Jan 17, 2025
@@ -94,14 +94,31 @@ static int cmd_write_value(const struct shell *sh, size_t argc, char **argv)
return 0;
}

static bool device_is_dac(const struct device *dev)
{
return device_is_ready(dev) && DEVICE_API_IS(dac, dev);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shell_device_filter already checks device_is_ready so this is superfluous

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey you are right! I had copy pasted this from other drivers, removed from all of these and added an extra patch to clean up the existing ones. Thanks!

Add shell device name filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <[email protected]>
Add shell device name filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <[email protected]>
Add shell device name filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <[email protected]>
Drop few redundant device_is_ready for functions that are only used as
argument to shell_device_filter, as shell_device_filter checks for that
alrady.

Suggested-by: Yishai Jaffe <[email protected]>
Signed-off-by: Fabio Baltieri <[email protected]>
@fabiobaltieri fabiobaltieri dismissed stale reviews from keith-zephyr, kartben, and pdgendt via 705c71e January 19, 2025 00:40
@zephyrbot zephyrbot added area: Comparator area: LED Label to identify LED subsystem area: Stepper area: PWM Pulse Width Modulation labels Jan 19, 2025
@zephyrbot zephyrbot requested a review from anangl January 19, 2025 00:41
@@ -69,7 +69,7 @@ static void print_callback(const struct device *dev, const enum stepper_event ev

static bool stepper_device_check(const struct device *dev)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change the function name to device_is_stepper to match the rest?

@@ -336,9 +336,14 @@ static int cmd_i2c_speed(const struct shell *shell_ctx, size_t argc, char **argv
return 0;
}

static bool device_is_i2c(const struct device *dev)
{
return DEVICE_API_IS(i2c, dev);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i3c extends the i2c API, this should be special cased here.

Suggested change
return DEVICE_API_IS(i2c, dev);
return DEVICE_API_IS(i2c, dev) || DEVICE_API_IS(i3c, dev);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Comparator area: DAC Digital-to-Analog Converter area: I2C area: LED Label to identify LED subsystem area: PWM Pulse Width Modulation area: Regulators area: Stepper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants